package com.ciaojian.core.model;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 用户表
 * @author Atlakyn
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("d_user")
public class User extends Model<User> {
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.INPUT)
    private Integer id;
    private String telphone;
    private Date addTime;
    private String openid;
    private String unionid;
    @TableField("avatarUrl")
    private String avatarUrl;

    @TableField("nickName")
    private String nickName;

    private String name;
    private String gender;
    private Integer age;
    private String career;
    private String education;
    private String born;
    private Integer storeId;
    private Integer isUpload;
    private Integer isDistribution;
    private Integer groupId;
    private Integer p1;
    private Integer p2;
    private Integer p3;
    private double balance;
    private double balanceTotal;
    private Integer integral;
    private Integer level;
    private String cName;
    private String cTelphone;
    private String cAddress;
    private java.sql.Date lastCutDate;
    private String fromPath;
    private String hairstyle;
    private String follow;
    private Integer hey;
    private Date updateTime;

    /**
     * 会员类型
     * 0 非会员
     * 1 普通会员
     * 2 联名会员
     */
    private Integer memberType;

    private Date joinMeberTime;

    private Date memberExpiredTime;

    private Integer isLogin;

    private String userLabels;

    @TableField(exist = false)
    private String token;

    private boolean isWx;
    private boolean isDy;

    private Date dyAddTime;
    private String dyOpenid;
    private String dyUnionid;
    private String dyAnonymousOpenid;

    @TableField("dy_nickName")
    private String dyNickName;

    @TableField("dy_avatarUrl")
    private String dyAvatarUrl;

    public void copy(User source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
